﻿#define _CRT_SECURE_NO_WARNINGS 
#include<stdio.h>



//leetcode算法题（暑假练习
/////////////////////////////////////////////////////////////
int ﬁndMaxConsecutiveOnes(int* nums, int numsSize) {
	int max_count = 0, cur_size = 0;;
	for (int i = 0; i < numsSize; i++) {
		if (nums[i] == 1) {
			cur_size++;
		}
		else {
			max_count = max_count > cur_size ? max_count : cur_size;
			cur_size = 0;
		}
	}
	max_count = max_count > cur_size ? max_count : cur_size;
	return max_count;
}

int findMaxConsecutiveOnes(int* nums, int numsSize) {
    //int tmp=nums[0];
    int count = 0;
    int maxc = 0;
    for (int i = 0; i < numsSize; i++)
    {
        //if(nums[i]==tmp)
        if (nums[i] == 1)
        {
            count++;
        }
        else
        {
            maxc = maxc > count ? maxc : count;
            count = 0;
        }
    }
    maxc = maxc > count ? maxc : count;
    return maxc;
}


////////////////////////////////////////////////////////////
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int tmp[100] = { 0 };
    int j = 0;
    int G = 0;
    while (n--) {
        for (int i = 1; i <= n; i++) {
            if (n % i == 0) {
                tmp[j++] = i;
            }
        }
        int count = 0;
        for (int k = 0; k < j - 1; k++) {
            count += tmp[k];
        }
        if (n == count)
        {
            G++;
        }
    }
    printf("%d ", G);
    return 0;
}


/////////////////
#include <stdio.h>


#include <math.h>
int is_perfect_num(int num) {
    int sum = 1;
    for (int i = 2; i <= sqrt(num); i++) {
        if (num % i == 0) {//判断是否能够整除i，能整除则i和结果都是约数
            sum += i; //与除数相加
            if (i != sqrt(num))//防止除数和结果相同的情况下重复相加
                sum += num / i; //与相除结果相加
        }
    }
    if (sum == num)
    {
        return 1;
    }
    return 0;
}

int main() {
    int n;
    int count = 0;
    scanf("%d", &n);
    for (int i = 2; i <= n; i++)
    {
        if (is_perfect_num(i))
        {
            count++;
        }
    }
    printf("%d ", count);
    return 0;
}

/////////////////////////////////////////////
